package TestHttpClient;

import java.io.IOException;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.Header;
import org.apache.http.HttpEntity;

public class helloHttpClient {
	public void itest() throws Exception {
		try {
			String url = "http://www.baidu.com";
			HttpClient client = new DefaultHttpClient();
			HttpGet method = new HttpGet(url);
			HttpResponse resp = client.execute(method);
			Header[] headers = resp.getAllHeaders();
			HttpEntity entity = resp.getEntity();
	
			System.out.println(headers);
			System.out.println(entity);
	
	} catch( Exception e) {
			e.printStackTrace();
		}
	}
}
